<{include file ="header.tpl"}>
<{include file ="navibar.tpl"}>
<{include file ="sidebar.tpl"}>
<!-- TPLSTART 以上内容不需更改，保证该TPL页内的标签匹配即可 -->

<{$osadmin_action_alert}>
<{$osadmin_quick_note}>
<div class="btn-toolbar">
	<a href="machine_add.php" class="btn btn-primary"><i class="icon-plus"></i> 添加主机</a>
</div>
<div style="border:0px;padding-bottom:5px;height:auto">
	<form action="" method="GET" style="margin-bottom:0px" id="machine-search-form">
	<div style="float:left;margin-right:5px">
		<label>选择装机起始时间 </label>
		<input type="text" id="start_date" name="start_date" value="<{$_GET.start_date}>" placeholder="起始时间" class="beg_time">
	</div>
	<div style="float:left;margin-right:5px">
		<label>选择装机结束时间</label>	
		<input type="text" id="end_date" name="end_date" value="<{$_GET.end_date}>" placeholder="结束时间" class="end_time"> 
	</div>
	<div style="float:left;margin-right:5px">
		<label>模糊搜索</label>
		<input type="text" name="search_val" value="<{$_GET.search_val}>" placeholder="输入主机序列号 /联系人/单位/编号" style="width:250px;"> 
	</div>

	<div class="btn-toolbar" style="padding-top:25px;padding-bottom:0px;margin-bottom:0px">
		<button type="submit" class="btn btn-primary"><strong>检索</strong></button>
	</div>
	<div style="clear:both;"></div>
	<input type="hidden" name="orderByFiled" id="orderById" value="">
	<input type="hidden" name="descOrAsc" id="descOrAscId" value="">
	</form>
</div>
<div class="block">
	<a href="#page-stats" class="block-heading" data-toggle="collapse">主机列表</a>
	<div id="page-stats" class="block-body collapse in">
		<table class="table table-striped">
			<thead>
			<tr>
				<th>#</th>
				<th>客户编号</th>
				<th>序列号</th>
				<th>主机型号</th>
				<th>联系人</th>
				<th>单位</th>
				<th>工程师</th>
				<th><a href="javascript:;" rel-asc="<{$_GET.descOrAsc}>" class="last-vistor-time" field="last_vistor_time" onclick="getDesc()" id="clickId">最后一次拜访日期</a></th>
				<th width="80px">操作</th>
			</tr>
			</thead>
			<tbody>							  
			<{foreach name=machine from=$machines item=machine}>				 
				<tr>
					<td><{$machine.machine_id}></td>
					<td><{$machine.custom_code}></td>
					<td><{$machine.serial_number}></td>
					<td><{$machine.host_number}></td>
					<td><{$machine.contacts_user}></td>
					<td><{$machine.terminal_client}></td>
					<td><{$machine.engineer}></td>
					<td><{$machine.last_vistor_time}></td>
					<td>
						<a href="machine_modify.php?method=modify&machine_id=<{$machine.machine_id}>" title="修改"   ><i class="icon-pencil"></i></a>
						<a data-toggle="modal" href="#myModal"  title= "删除" ><i class="icon-remove" href="machine.php?method=del&machine_id=<{$machine.machine_id}>#myModal" data-toggle="modal" ></i></a>
					</td>
				</tr>
			<{/foreach}>
		  </tbody>
		</table>  
	</div>
	<!--- START 分页模板 --->
            <{$page_html}>
    <!--- END --->
</div>
<script>
	function getDesc(){
		$this = $("#clickId");
		var descOrAsc = $this.attr("rel-asc") == "" ? "desc" : $this.attr("rel-asc");
		var fieldVal = $this.attr("field");
		if(descOrAsc == "desc"){
			$this.attr("rel-asc","asc");
			$("#descOrAscId").val("asc");
		}else{
			$this.attr("rel-asc","desc");
			$("#descOrAscId").val("desc");
		}
		$("#orderById").val(fieldVal);	
		$("#machine-search-form").submit();
	}
</script>
<script>
$(function() {
	var beg_time=$( ".beg_time" );
	beg_time.datepicker({ dateFormat: "yy-mm-dd" });
	beg_time.datepicker( "option", "firstDay", 1 );
	
	var end_time=$( ".end_time" );
	end_time.datepicker({ dateFormat: "yy-mm-dd" });
	end_time.datepicker( "option", "firstDay", 1 );
	
});
</script>
<!---操作的确认层，相当于javascript:confirm函数--->
<{$osadmin_action_confirm}>
	
<!-- TPLEND 以下内容不需更改，请保证该TPL页内的标签匹配即可 -->
<{include file="footer.tpl" }>